#ifdef KITSCHY_DEBUG_MEMORY 
#include "debug_memorymanager.h"
#endif

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"

#include "BList.h"
#include "BVector.h"
#include "geometrics.h"
#include "quaternion.h"
#include "symbol.h"
#include "sort.h"
#include "ontology.h"
#include "featureterm.h"
#include "FTKBase.h"

#include "AWLocalViewport.h"

#include "AWEntity.h"
#include "AWMessage.h"
#include "AWScenario.h"
#include "AWBody.h"
#include "AWSensor.h"
#include "AWBrain.h"
#include "AWTracerBrain.h"
#include "AWAgent.h"
#include "AWWorld.h"

#include "loader.h"



AW_TracerBrain::AW_TracerBrain(Ontology *O,FTKBase *Memory) : AW_Brain(O,Memory) 
{
	class_name->set("AW_TracerBrain");
} /* AW_TracerBrain::AW_TracerBrain */ 


AW_TracerBrain::AW_TracerBrain(FILE *fp,Ontology *O,FTKBase *Memory) : AW_Brain(O,Memory)
{
	class_name->set("AW_TracerBrain");

	load(fp);
} /* AW_TracerBrain */ 


AW_TracerBrain::~AW_TracerBrain() 
{
} /* AW_TracerBrain::~AW_RandomBrain */ 



bool AW_TracerBrain::load(FILE *fp)
{
	if (!AW_Brain::load(fp)) return false;

	return true;
} /* AW_TracerBrain::load */ 


bool AW_TracerBrain::save(FILE *fp)
{
	if (!AW_Brain::save(fp)) return false;
	
	return true;
} /* AW_TracerBrain::save */ 


void AW_TracerBrain::actualize(float time,float timeinc,List<AW_Message> *message_queue,
							   Symbol *me,
							   List<FeatureTerm> *sensor_data,	
							   List<FeatureTerm> *posibles,List<FeatureTerm> *l)
{
	AW_Message *m;

	message_queue->Rewind();
	while(message_queue->Iterate(m)) process_message(m,time,timeinc,me,sensor_data,posibles,l);

	message_queue->Delete();

	decode_input(time,timeinc,me,sensor_data,posibles,l);
	generate_ops(time,timeinc,me,sensor_data,posibles,l);
} /* AW_TracerBrain::actualize */ 


bool AW_TracerBrain::process_message(AW_Message *m,
									 float,float,
								     Symbol *,
									 List<FeatureTerm> *,
								     List<FeatureTerm> *,
								     List<FeatureTerm> *)
{
	return false;
} /* AW_TracerBrain::process_message */ 


void AW_TracerBrain::decode_input(float ,float ,
								  Symbol *,
								  List<FeatureTerm> *,
								  List<FeatureTerm> *,
								  List<FeatureTerm> *)
{


} /* AW_TracerBrain::decode_input */ 


void AW_TracerBrain::generate_ops(float ,float,
								  Symbol *,
								  List<FeatureTerm> *,
								  List<FeatureTerm> *,
								  List<FeatureTerm> *)
{
} /* AW_TracerBrain::generate_ops */ 


bool AW_TracerBrain::is_a(char *c)
{
	if (strcmp(c,"AW_TracerBrain")==0) return true;

	return AW_Brain::is_a(c);
} /* AW_TracerBrain::is_a */ 


bool AW_TracerBrain::is_a(Symbol *c)
{
	if (c->cmp("AW_TracerBrain")) return true;

	return AW_Brain::is_a(c);
} /* AW_TracerBrain::is_a */ 
